<extend name="Public:base" />
<block name="content">
<div class="row">
	<div class="col-xs-12">
		<volist name="inf" id="vo">
		<form class="form-horizontal"  id="validation-form" method="post" action='{$action}'>
			<input name="status_id" type="hidden" value="{$Think.get.id}" />
			<input name="user_type" type="hidden" value="{$vo.user_type}"/>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">状态名称：</label>
			<div class="col-sm-10">
				<div class="clearfix">
					<input name="name" id="name" class="col-xs-10 col-sm-5"  value="{$vo.name}" type="text">
				</div>
			</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">状态描述：</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="content" id="content" class="col-xs-10 col-sm-5"  value="{$vo.content}" type="text">
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">二次描述：</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="content1" id="content1" class="col-xs-10 col-sm-5"  value="{$vo.content1}" type="text">
					</div>
				</div>
			</div>
			<div class="space-4"></div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left" style="visibility: hidden;">二次描述 </label>
				<div class="col-sm-10">
					<input id="send" name="send" type="submit" value="提交" class="btn btn-primary btn-sm radius5" />
					<php>if($type==1){</php>
					<a href="{:U('OrderStatus/User')}" class="btn btn-primary btn-sm radius5">返回</a>
					<php>}else{</php>
					<a href="{:U('OrderStatus/Master')}" class="btn btn-primary btn-sm radius5">返回</a>
					<php>}</php>
				</div>
			</div>
		</form>
		</volist>
	</div>
</div>
</block>
<block name="javascript">
<script src="__JS__/jquery.validate.min.js"></script>
<script>
$(function(){

	$('#validation-form').validate({
			errorElement: 'div',
			errorClass: 'help-block',
			focusInvalid: false,
			rules: {
				name: {
					required: true,
					minlength: 2
				},
				content: {
					required: true,
					minlength: 7
				},
				content1: {
					required: false,
					minlength: 7
				}
			},

			messages: {

				name: {
					required: "必填",
					minlength: "不得少于2个字"
				},
				content: {
					required: "必填",
					minlength: "不得少于7个字"
				},
				content1: {
					required: "必填",
					minlength: "不得少于7个字"
				}

			},

			invalidHandler: function (event, validator) { //display error alert on form submit
				$('.alert-danger', $('.login-form')).show();
			},

			highlight: function (e) {
				$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
			},

			success: function (e) {
				$(e).closest('.form-group').removeClass('has-error').addClass('has-info');
				$(e).remove();
			},

			errorPlacement: function (error, element) {
				 error.insertAfter(element.parent());
			},

		});

	$('#send').click(function(){
		$('#validation-form').ajaxSubmit(function(data){
			if(data=='1'){
				$.jbox.tip("修改成功！", 'loading');
				window.setTimeout(function () {window.location.href="{:U('OrderStatus/User')}"; }, 500);
			}if(data=='2'){
				$.jbox.tip("修改成功！", 'loading');
				window.setTimeout(function () {window.location.href="{:U('OrderStatus/Master')}"; }, 500);
			}if(data=='-1') {
				$.jbox.info('没有任何修改！', '提示');
			}
		});

		return false;
	})

});
</script>
</block>